********************************************************************************
*** /* BES ANALYSIS TABLE A1 */ ***               */ ***
********************************************************************************

clear
	clear matrix
	clear mata
	set more off
	set mem 5000m
	set maxvar 20000
	
cd "/Users/yarasleiman/Desktop/PSRM_Replication"

********************************************************************************
use "DATA/bes_rps_2019_1.3.0.dta", clear
********************************************************************************

**# Cleaning

*Party
recode b02 ///
(1=1 "Labour") ///
(2=0 "Conservative") ///
(else=.), gen (labour_cons)

*Education: edlevel

recode edlevel ///
(0/3 = 0 "No degree") ///
(4/5 = 1 "Degree") ///
(else=.), gen (degree)

*Income: y01_Annual

replace y01_Annual = . if y01_Annual < 1

*Gender: gender
recode y09 ///
(1=1 "Male") ///
(2=0 "Female") ///
(else=.), gen (gender)

*Ideology: left_right

replace e01 = . if e01 < 0
ren e01 left_right

*Ethnicity: ethnicity

recode y11 ///
(1/4 = 1 "White") ///
(5/8 = 2 "Mixed") ///
(9/13 = 3 "Asian") ///
(14/16 = 4 "Black") ///
(17/18 = 5 "Other") ///
(else=.), gen (ethnicity)

recode ethnicity ///
(1=1 "White") ///
(2/5 = 0 "Non-white") ///
(else=.), gen (white)

*Political attention: pol_att

replace k01 = . if k01 <0
ren k01 pol_att

*Econ vs enviro

replace h01 = . if h01 < 0
ren h01 env

*Retrosp econ evaluation

replace l04 = . if l04 <0
ren l04 eval_econ

**# Table A1

logit labour_cons i.degree y01_Annual i.region Age i.gender left_right i.white pol_att env eval_econ [pweight=wt_vote], r 

estimates store main_effects
esttab main_effects using "TAB/table_A1.csv", se bfmt(3) sefmt(3) label replace

